//
//  StringAxisValueFormatter.m
//  ERP
//
//  Created by QA on 2017/8/7.
//  Copyright © 2017年 ShangHai HaoLei Software Technology Co., Ltd. All rights reserved.
//

#import "StringAxisValueFormatter.h"

@interface StringAxisValueFormatter()

@property (nonatomic, strong) NSArray *dataArray;

@end

@implementation StringAxisValueFormatter

- (id)initWithData:(NSArray<NSString*>*)array
{
    self = [super init];
    if (self) {
        self.dataArray = array;
    }
    return self;
}

- (NSString *)stringForValue:(double)value axis:(ChartAxisBase *)axis
{
    NSInteger intValue = (NSInteger)value;
    if(_dataArray && intValue < _dataArray.count)
        return _dataArray[intValue];
    else
        return @"";
}

@end
